package itdep.services;

import ga.domain.repository.EntityCriteria;
import ga.domain.repository.GenericEntityFilterProcessor;
import itdep.domain.NamedEntity;
import org.springframework.util.StringUtils;

/**
 * @author Ivan Khalopik
 * @version $Revision: 17 $ $Date: 2010-06-16 16:55:55 +0000 (Wed, 16 Jun 2010) $
 */
public class NamedEntityFilterProcessor extends GenericEntityFilterProcessor<NamedEntity, NamedEntityFilter<NamedEntity>> {
	public NamedEntityFilterProcessor() {
		super(NamedEntity.class);
	}

	@Override
	protected void processFilter(EntityCriteria criteria, NamedEntityFilter<NamedEntity> filter) {
		if (StringUtils.hasText(filter.getName())) {
			criteria.add(criteria.getProperty(NamedEntity.NAME_PROPERTY).eq(filter.getName()));
		}
	}
}